import { store } from "@/store";

export const useApiStore = defineStore("api", () => {
  const baseUrl = import.meta.env.VITE_APP_API_URL;
  // druid Sql监控
  const druidApi = baseUrl + "/druid/index.html";
  // swagger文档
  const swaggerApi = baseUrl + "/swagger-ui.html";
  // knife4j文档
  const knife4jApi = baseUrl + "/doc.html";

  return {
    baseUrl,
    druidApi,
    swaggerApi,
    knife4jApi,
  };
});

/**
 * 用于在组件外部（如在Pinia Store 中）使用 Pinia 提供的 store 实例。
 * 官方文档解释了如何在组件外部使用 Pinia Store：
 * https://pinia.vuejs.org/core-concepts/outside-component-usage.html#using-a-store-outside-of-a-component
 */
export function useApiStoreHook() {
  return useApiStore(store);
}
